﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace KC.Presentation.Mv8CMS
{
	public partial class ActivityPeeker : Form
	{
		public ActivityPeeker(int SessionId)
		{
			InitializeComponent();
			dgActivities.DataSource = KC.DataAccess.MV.Utils.GetActivitiesBySession(SessionId);
		}

		private void dgActivities_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
		{
			switch (e.ColumnIndex)
			{
				case 3:
					if (string.IsNullOrEmpty((string)dgActivities.Rows[e.RowIndex].Cells[3].Value)) return;
					string text = (string)dgActivities.Rows[e.RowIndex].Cells[3].Value;
					string target = "";
					if (!text.ToLower().Contains("http://")) target = "http://www.kconnolly.net";
					if (!text.ToLower().Contains("http://") && !text.Trim().StartsWith("/")) target += "/";
					if (text.Trim().StartsWith("/")) target = "http://www.kconnolly.net";
					target += text;
					System.Diagnostics.Process.Start(target);

					break;
			}
		}

		private void button1_Click(object sender, EventArgs e)
		{
			Close();
		}
	}
}
